package com.jml.event;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.event.TransactionalEventListener;

@Service
public class MyEventListenerAnnotation {

    public MyEventListenerAnnotation() {
        System.out.println("MyEventListenerAnnotation init");
    }
    //把这个方法放在监听器内，然后反射执行这个方法。一个注解就生成一个监听器
    @EventListener
    public void a(Myevent myevent){
        System.out.println("收到了事件:"+myevent.memo);
    }
}
